package com.kzd.gtboon.jetpack.api

import com.kzd.gtboon.app.*
import com.kzd.gtboon.entity.*
import com.module.lemlin.http.HttpResponseDataE
import com.module.lemlin.http.HttpResponseDataT
import rxhttp.RxHttp
import rxhttp.toClass

/**
 * 我的礼包
 * */
suspend fun personalMyGift(
    keyword: String? = null, page: String, limit: String,
): HttpResponseDataE<GameGift> = RxHttp.postForm(PERSONAL_MY_LB)
    .add("keyword", keyword)
    .add("p", page)
    .add("limit", limit)
    .toClass<HttpResponseDataE<GameGift>>()
    .await()

/**
 * 获取兑换码
 * */
suspend fun personalGetExchangeCode(id: String): HttpResponseDataT<String> =
    RxHttp.postForm(PERSONAL_GET_EXCHANGE_CODE)
        .add("id", id)
        .toClass<HttpResponseDataT<String>>()
        .await()

/**
 * 兑换码数据
 * */
suspend fun personalGetExchangeCodeList(): HttpResponseDataE<GameExchange> =
    RxHttp.postForm(PERSONAL_GET_EXCHANGE_CODE_LIST)
        .toClass<HttpResponseDataE<GameExchange>>()
        .await()